#include <stdio.h>

int main()
{
	int num;
	scanf("%d",&num);
	int ret=num;
	int ch[10];
	int count=0;
	if(ret==0)
	printf("0");
	while(ret>0)
	{
		ch[count]=ret%8;
		ret/=8;
		count++;
	}
	int i;
	for(i=count-1;i>=0;i--)
	{
		printf("%d",ch[i]);
	}
	return 0;
}